/*******************************************************************************
 * Package: com.song.boot.springstudy.redis.clean
 * Type:    Fifo
 * Date:    2025/6/19 10:45
 *
 * Copyright (c) 2025 LTD All Rights Reserved.
 *
 * You may not use this file except in compliance with the License.
 *******************************************************************************/
package com.song.boot.springstudy.redis.clean;

import java.util.Deque;
import java.util.LinkedList;

/**
 * 功能描述： 阈值清理机制
 *  fifo: 先进先出
 * @author Songxianyang
 * @date 2025/6/19 10:45
 */
public class Fifo {
    public static void main(String[] args) {
        Deque<String> deque = new LinkedList();
        for (int i = 0, size = 5; i < size; i++) {
            deque.add("第几个" + i);
        }
        System.out.println("deque.toString() = " + deque.toString());
        // System.out.println("deque.poll() = " + deque.poll());
        System.out.println("---------------");
        // System.out.println("deque.toString() = " + deque.toString());
        // todo 数目阈值 ==5
        if (deque.size()==5) {
            System.out.println("我要被移除并且返回当前值" + deque.poll());
        }
        System.out.println("deque.toString() = " + deque.toString());

    }
}
